package cn.enzo.yun.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.enzo.utils.service.CommonServiceImpl;
import cn.enzo.yun.dao.SaleDao;
import cn.enzo.yun.domain.Sale;
import cn.enzo.yun.service.ISaleService;


@Service
public class SaleServiceImpl extends CommonServiceImpl<Sale> implements ISaleService {

	@Autowired
	private SaleDao saleDao;
	
	
	@Override
	public Integer save(Sale entity) throws Exception{
		entity.setCreatetime(new Date());
		entity.setIsdelete(false);
		return saleDao.save(entity);
	}
	
	@Override
	public Sale selectByKey(Object key) throws Exception{
		return saleDao.selectByKey(key);
	}
	
	@Override
	public Integer deleteBykey(Object key) throws Exception{
		Sale Sale = saleDao.selectByKey(key);
		Sale.setIsdelete(true);
		return saleDao.update(Sale);
	}
	
	
	@Override
	public List<Sale> queryByCondition(Sale entity) throws Exception {
		return saleDao.queryByCondition(entity);
	}
}
